package zzz.javademo;

import com.tsp.ssm.po.Ceituserli;

import java.util.Date;

/**
 * Created by 隼 on 2016/12/13.
 * 带标签的循环
 */
public class demo1 {
    public void demobreak() {
        outer: for(int i=0;i<3;i++){
            inner:for(int j=0;j<3;j++){
                if(j>1) break outer;
                System.out.println(j+" and "+i);
            }
        }
    }
    public void continuedemo(){
        int num=0;
        System.out.println("200-300之间的素数为：");
        outer:for(int i=201;i<300;i+=2){
            for(int j=2;j<i;j++){
                if(i%j==0)
                    continue  outer;
            }
            System.out.print(i);
            num++;
            if(num%10==0)
                System.out.println();
            else
                System.out.print("\t");
        }
    }

    public void LoopControl(){
        outer:
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(j>i){
                    System.out.println();
                    continue outer;
                }
                System.out.print("*");
            }
        }
    }


    //输入英文字母A——Z及其对应的Unicode编码值
    public void CharUnicodeTest(){
        int number=1;
        for(char c='A';c<='Z';c++){
            System.out.println(c+" "+(int )c );
            if(number%5==0)
                System.out.print("\n");
            else
                System.out.println("\t\t");
        }
    }
    //随机产生一个50,100之间的整数并判断其是否为素数
    public void  randomPrimeTest(){
        int i=(int)(Math.random()*49+51);
        System.out.println("the random number is:  "+i);
        int j;
        for(j=2;j<i;j++){
            if(i%j==0){
                break;
            }
        }
        if(j==i){
            System.out.println("素数");
        }else{
            System.out.println("不是素数");
        }
    }


    public static void main(String[] args) {

        String s="ABCD";
        s.concat("E");
        s.replace("C","F");
        System.out.println(s);
        int b=3,c=8;
        System.out.println(c+=c--/++b);
        Ceituserli user=new Ceituserli();
        user.setId(1);
        user.setName("zzz");
        user.setBirthday(new Date(116,10,26));
        String a="2016";
        String z="5";
        String j="6";
        new Date(Integer.parseInt(a, 10)-1900,Integer.parseInt(z, 10),Integer.parseInt(j, 10));
        System.out.println(new Date(116,10,26).toString());
        System.out.println(new Date(Integer.parseInt(a, 10)-1900,Integer.parseInt(z, 10),Integer.parseInt(j, 10)));
        System.out.println("zzzz");
    }
}
